package com.ruoyi.novel.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.novel.mapper.RecordsMapper;
import com.ruoyi.novel.domain.Records;
import com.ruoyi.novel.service.IRecordsService;

/**
 * 记录Service业务层处理
 *
 * @author 张三
 * @date 2025-04-27
 */
@Service
public class RecordsServiceImpl extends ServiceImpl<RecordsMapper, Records> implements IRecordsService
{
    @Autowired
    private RecordsMapper recordsMapper;

    /**
     * 查询记录
     *
     * @param id 记录主键
     * @return 记录
     */
    @Override
    public Records selectRecordsById(Integer id)
    {
        return recordsMapper.selectRecordsById(id);
    }

    /**
     * 查询记录列表
     *
     * @param records 记录
     * @return 记录
     */
    @Override
    public List<Records> selectRecordsList(Records records)
    {
        return recordsMapper.selectRecordsList(records);
    }

    /**
     * 新增记录
     *
     * @param records 记录
     * @return 结果
     */
    @Override
    public int insertRecords(Records records)
    {
        records.setCreateTime(DateUtils.getNowDate());
        return recordsMapper.insertRecords(records);
    }

    /**
     * 修改记录
     *
     * @param records 记录
     * @return 结果
     */
    @Override
    public int updateRecords(Records records)
    {
        records.setUpdateTime(DateUtils.getNowDate());
        return recordsMapper.updateRecords(records);
    }

    /**
     * 批量删除记录
     *
     * @param ids 需要删除的记录主键
     * @return 结果
     */
    @Override
    public int deleteRecordsByIds(Integer[] ids)
    {
        return recordsMapper.deleteRecordsByIds(ids);
    }

    /**
     * 删除记录信息
     *
     * @param id 记录主键
     * @return 结果
     */
    @Override
    public int deleteRecordsById(Integer id)
    {
        return recordsMapper.deleteRecordsById(id);
    }
}
